package com.bestcem.xm.user.config.properties;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 问卷网相关配置信息
 *
 * @author qiongyu.cui <qiongyu.cui@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/4 17:52
 */
@Component
@Data
@ConfigurationProperties(prefix = "app.user.wenjuan")
public class WenJuanProperties {

    private static final String GET_TOKEN_URL = "/connect_login/get_token/";
    private static final String GET_MEMBER_INFO_URL = "/connect_login/get_memberinfo/";

    @Autowired
    private SettingProperties settingProperties;

    /**
     * 接口域名地址
     */
    private String baseUrl;
    /**
     * appKey
     */
    private String appKey;
    /**
     * 秘钥
     */
    private String appSecret;
    /**
     * 平台code
     */
    private String siteName;

    /**
     * 获取token的接口url
     */
    public String getTokenUrl() {
        return baseUrl + GET_TOKEN_URL;
    }

    /**
     * 获取用户信息的接口url
     */
    public String getMemberInfoUrl() {
        return baseUrl + GET_MEMBER_INFO_URL;
    }

    public String getSiteName() {
        return settingProperties.getRedPaperPlatformCode();
    }
}
